/* ************************************************************************
> File Name:     3.c
> Author:        zhfu
> mail:          3346897597@qq.com
> Created Time:  2022年04月19日 星期二 21时15分47秒
> Description:   
 ************************************************************************/
#include<stdio.h>

unsigned int multiply(unsigned int x, unsigned int y){
    unsigned int ret = 0;
    unsigned factor = 0;

    for (int i = 0; i < 32; ++i){
        if (y & 0x1){
            ret += x << factor; 
        }
        ++factor;
        y >>= 1;
    }

    return ret;
}

int main()
{
    unsigned int a = 12, b = 24;

    printf("%u * %u = %u\n", a, b, multiply(a, b));

    return 0;
}
